package com.ruoyi;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.MessageFormat;

/**
 * 启动程序
 *
 * @author ruoyi
 */
@EnableSwagger2WebMvc
@EnableKnife4j
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class},scanBasePackages = {"com.ruoyi", "com.wash.shoes"})
public class WashApplication {
    public static void main(String[] args) throws UnknownHostException {

        ConfigurableApplicationContext application = SpringApplication.run(WashApplication.class, args);
        Environment env = application.getEnvironment();

        String s = MessageFormat.format("\n----------------------------------------------------------\n\t" +
                        "应用 '{0}' 运行成功! 访问连接:\n\t" +
                        "Swagger文档: \t\thttp://{1}:{2}/swagger-ui/index.html#/\n" +
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));

        System.out.println(s);
        System.out.println("http://localhost:8080/swagger-ui/index.html#/");
    }
}
